﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using RenAi.Medical.Model;
using RenAi.Medical.BLL;

namespace RenAi.Medical.Admin
{
    public partial class jiuyizhinan : System.Web.UI.Page
    {
        //实例化对象
        ParticularBLL bll = new ParticularBLL();
        public void ParLoad()
        {
            this.Repeater1.DataSource = bll.GetParticular();
            this.Repeater1.DataBind();//绑定数据信息
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                ParLoad();
            }
        }

        protected void Repeater1_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            string eName = e.CommandName;
            string Particular_Id = e.CommandArgument.ToString();
            switch (eName)
            {
                case "Delete":
                    if (bll.DeleteParticular(Particular_Id) > 0)
                    {
                        Response.Write("<script>alert('删除成功！');</script>");
                        ParLoad();
                    }
                    break;
                case "Update":
                    //页面跳转
                    Response.Redirect("Par_Update.aspx?Particular_Id=" + Particular_Id);
                    break;
            }
        }
    }
}